package ${pkgName };

import com.ld.shieldsb.annotation.field.DealField.Field;
import com.ld.shieldsb.annotation.field.db.ColumnName;
import com.ld.shieldsb.annotation.model.ModelAnno.Model;
import com.ld.shieldsb.annotation.model.ModelAnno.TableName;

import java.io.Serializable;
import java.util.Date;

import lombok.Data;

/**
 * 
 * ${modelComments}(${tableName})
 * 
 * @ClassName ${className}
<% if ( isNotEmpty(email) ) { %>
 * @author <a href="mailto:${email}" target="_blank">${author!"无名氏"}</a>
<% } else { %>
 * @author ${author!"无名氏"}
<% } %>
 * @date ${nowTime}
 *
 */
@Model(name = "${modelComments}")
@TableName("${tableName}")
@Data
public class ${className} implements Serializable {
    private static final long serialVersionUID = ${serialID};
    
    <% //循环输出属性 %>
    <% for (fieldModel in fieldList) {
        // @表示直接引用java方法，注意和下一行的调用方式区分
        if ( isNotEmpty ( @fieldModel.getComments() ) ) {
            print("\t/*"+fieldModel.comments+"*/\r\n");
            //print("\t@Field(name = \""+fieldModel.comments+"\")\r\n");
        }
        // 数据库与field名称不一致时,忽略大小写
        if ( strutil.toLowerCase(fieldModel.columnName) != strutil.toLowerCase(fieldModel.fieldName) ) {
            print("\t@ColumnName(\""+fieldModel.columnName+"\")\r\n");
        }
        //验证输出 
        for (formvm in fieldModel.formvalidateMethods!) { 
			if (formvm=='required') {
				print("\t@NotEmpty(message=\""+@fieldModel.getComments()+"不能为空！\")\r\n");
			} else if (formvm=='mphone') {
				print("\t@Mphone(message=\""+@fieldModel.getComments()+"必须是手机号！\")\r\n");
			} else if (formvm=='email') {
				print("\t@Email(message=\""+@fieldModel.getComments()+"必须是邮箱！\")\r\n");
			}
	    }
        print("\tprivate " + @fieldModel.getFieldType() + " " + @fieldModel.getFieldName() + ";\r\n");

    }
    %>
}
